import 'package:flutter/material.dart';
import 'common/app_color_size.dart';
import 'components.dart';
import 'function.dart';
import 'other.dart';


class IndexPage extends StatefulWidget {
  IndexPage({Key key}) : super(key: key);

  @override
  _MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}

class _MyStatefulWidgetState extends State<IndexPage> {
  int _selectedIndex = 0;
  static const TextStyle optionStyle =
      TextStyle(fontSize: 30, fontWeight: FontWeight.bold);

  void _onItemTapped(int index) {
    setState(() {
      _selectedIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // appBar: AppBar(
      //   title: const Text('BottomNavigationBar Sample'),
      // ),
      body: IndexedStack(
        children: <Widget>[ComponentsPage(),FunctionPage(),OtherPage()],
        index: _selectedIndex,
      ),
      bottomNavigationBar: BottomNavigationBar(
        items: const <BottomNavigationBarItem>[
          BottomNavigationBarItem(
            icon: Icon(Icons.home),
            title: Text('组件'),
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.business),
            title: Text('功能'),
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.school),
            title: Text('其他'),
          ),
        ],
        currentIndex: _selectedIndex,
        selectedItemColor: appPrimaryColor,
        onTap: _onItemTapped,
      ),
    );
  }
}